package com.xx.controller;

import com.alibaba.fastjson.JSON;
import com.xx.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class MyController {
    @ResponseBody
    @RequestMapping("/testJson")
    public User testJson(@RequestBody User user) {
        System.out.println(user);
        return user;
    }

    @ResponseBody
    @RequestMapping("/rest/{id}")
    public User selectUser(@PathVariable String id) {
        System.out.println(id);
        User user = new User();
        user.setUsername("xx");
        user.setPwd("cc");
        return user;
    }
}
